package ThreadThree;

public class Account {
	String name;
	double balance;
	public Account(String name,double balance) {
		this.name=name;
		this.balance=balance;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public double getBalance() {
		return balance;
	}
	public void setBalance(double balance) {
		this.balance = balance;
	}
	
	public void saveMoney(double money) {
		balance+=money;
	}
	public double drawMoney(double money) {
		if(balance<=0)return 0;
		
		if(money<=balance) {
			balance-=money;
		}else {
			money=balance;
			balance=0;
		}
		return money;
		
	}

}
